using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class SchoolCMEmailMap : EntityTypeConfiguration<SchoolCMEmail>
    {
        public SchoolCMEmailMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.schoolname)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.email)
                .IsRequired()
                .HasMaxLength(200);

            this.Property(t => t.cc)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("SchoolCMEmail");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.schoolname).HasColumnName("schoolname");
            this.Property(t => t.schoolblurb).HasColumnName("schoolblurb");
            this.Property(t => t.localeid).HasColumnName("localeid");
            this.Property(t => t.email).HasColumnName("email");
            this.Property(t => t.cc).HasColumnName("cc");
            this.Property(t => t.lastsenddate).HasColumnName("lastsenddate");
        }
    }
}
